/**
 * Created by jianglinjie on Tue Oct 10 2017
 * @flow
 */
'use strict';
import type { CaptchaParam, CaptchaResult } from '../../serviceTypes';
import { FetchClient, JSONRequest } from '../../network';
import ConfigService from '../config';

const CAPTCHA_PATH = '/captchas';

class CaptchaService {
  async request(param: CaptchaParam): Promise<CaptchaResult> {
    let request = new JSONRequest(
      ConfigService.apiBaseHost + CAPTCHA_PATH, 
      null,
      param
    );

    let body = await FetchClient.start(request);
    
    return body.data;
  }
}

export default new CaptchaService();